package com.itheima;

import java.util.Scanner;



public class HealthCalculator {

    public static void getBmr(String sex, int age, double height, double weight){
        double bmr;
        double bmrMale= 66 + (13.7 * weight) + (5 * height) - (6.8 * age);;
        double bmrFeMale = 655 + (9.6 * weight) + (1.8 * height) - (4.7 * age);
        //三元运算符
        bmr = sex == "male" ? bmrMale : bmrFeMale;
        System.out.println("Your BMR is: " + bmr);

    }

    public static void getBmi(double weight, double height ){
        double bmi = weight / (height * height);
        if (bmi < 18.5) {
            System.out.println("Underweight");
        } else if (bmi >= 18.5 && bmi < 24.9) {
            System.out.println("Normal");
        } else if (bmi >= 24.9 && bmi < 29.9) {
            System.out.println("Overweight");
        } else {
            System.out.println("Obese");
        }
        System.out.println("BMI: " + bmi);
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter your sex(male or female): ");
        String sex = scanner.nextLine();
        System.out.println("Enter your age: ");
        int age = scanner.nextInt();
        System.out.println("Enter your height (m): ");
        double height = scanner.nextDouble();
        System.out.println("Enter your weight (kg): ");
        double weight = scanner.nextDouble();

        getBmi(weight, height);
        getBmr(sex, age, height, weight);
    }
}
